package leaveSystem.controller;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import leaveSystem.bizlogic.WorkScheduleManager;
import leaveSystem.dao.DAOFactory;
import leaveSystem.dao.mysql.Compensation_TrackingDaoImpl;
import leaveSystem.model.CompensationTracking;
import leaveSystem.model.Employee;

import com.mysql.jdbc.Connection;

public class LoadHistoryServlet extends HttpServlet{
	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Connection con = null;
		
		HttpSession session = request.getSession();
		Employee resultEmp = (Employee) session.getAttribute("currentSessionUser");
		
		
		/*WorkScheduleManager scheduleManager = new WorkScheduleManager();
		List<CompensationTracking> leaveDetails = scheduleManager.loadAll(null);*/
		Employee e=null;
		Connection conn = (Connection) DAOFactory.getDatabaseConnection();
		Compensation_TrackingDaoImpl cdip = new Compensation_TrackingDaoImpl();
		ArrayList<CompensationTracking> leaveDetails = cdip.LoadLeaveHistory(conn,e);
		String destination = "ApplyLeaveForm.jsp";
		 
		RequestDispatcher rd = getServletContext().getRequestDispatcher(destination);
		rd.forward(request, response);
	}

}
